using Microsoft.EntityFrameworkCore;
using Exercise.Api.Entity;

namespace Exercise.Api.Db
{
    public class ExerciseDb : DbContext
    {
        //因为要使用AddDbContext注册到容器，所以这里必须要有一个带参数的构造函数，并且必须传递DbContextOptions类型的参数，同时父级也得调用这个参数
        public ExerciseDb(DbContextOptions Options):base(Options)
        {

        }
        
        public DbSet<Users> Users { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<UserRoles> UserRoles { get; set; }
        public DbSet<AuditInfo> AuditInfo{get;set;}

        protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseSqlServer(@"server=DESKTOP-B0M4KE7 ;database=Exercise;uid=sa;pwd=123456;");
    }
}